import java.util.Arrays;
public class Test2 {
    public static void change(int[] arr){
        if(arr==null||arr.length==1){
            return;
        }
        int left=0;
        int right= arr.length-1;
        while (left<right){
            while (left<right&&arr[left]%2!=0){
                left++;
                while (left<right&&arr[right]%2==0){
                    right--;
                }
            }
            if(left<right){
                int temp=arr[left];
                arr[left]=arr[right];
                arr[right]=temp;
                left++;
                right--;
            }
        }
    }

    public static void main(String[] args) {
        int[] arr1={1,2,3,4,5};
        change(arr1);
        System.out.println(Arrays.toString(arr1));
    }
}
